<div class="layui-card">
    <div class="layui-card-header layuiadmin-card-header-auto">
        <form class="layui-form">
            <div class="layui-btn-group">
                <button id="refreshBtn" type="button" class="layui-btn layui-btn-sm layui-btn-primary" ><i class="layui-icon layui-icon-refresh-3"></i>刷新</button>
            </div>
        </form>
    </div>
    <div class="layui-card-body">
        <table id="dataTable" lay-filter="dataTable"></table>
    </div>
</div>


<?php
$url = yii\helpers\Url::to(['campaign']);
$js = <<<JS
    layui.use(['form','element','table', 'layer'],function() {
        var form = layui.form;  
        var element = layui.element;  
        var table = layui.table;  
        var layer = layui.layer;
        
        var dataTable = table.render({
            elem: '#dataTable'
            ,height: 'full-200'
            ,url: '{$url}' 
            ,page: false 
            ,cols: [[ 
                {checkbox: true}
                ,{field: 'name', title: '任务名称'}
                ,{field: 'total', title: '号码数'}
                ,{field: 'hasCall', title: '已呼数'}
                ,{field: 'leftCall', title: '未呼数'}
                ,{field: 'success', title: '接通数'}
                ,{field: 'transfer', title: '转接数'}
                ,{field: 'failed', title: '未接通数'}
                ,{field: 'estatus_name', title: '状态'}
                ,{field: 'max_canales', title: '最大并发'}
            ]]
        });
        
        //监听表单提交
        $("#refreshBtn").click(function() {
            dataTable.reload()
            return false
        })      
    });
JS;
$this->registerJs($js);
